// SDLGmud_1.0.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "SDLGmud.h"

SDLGmud::SDLGmud()
{
	//To keep things tidy, lets also set the Surf_Display pointer to NULL on the class constructor
	Surf_Display = NULL;
	Surf_Test = NULL;

	Running = true;
}

SDLGmud::~SDLGmud()
{
}

int SDLGmud::OnExecute()
{
	//We try to Initialize our game
	if(OnInit() == false)
	{
		return -1;
	}

	//If everything is good, we continue on to the game loop
	//A structure that holds information about events
	SDL_Event Event;

	while(Running) 
	{   
		//A function that will grab any events waiting in the queue
		while(SDL_PollEvent(&Event))
		{  
			//We use SDL_PollEvent to check for events, and pass them one at a time to OnEvent
			/*
			E.g. the user presses A and moves the mouse during the OnRender() function. 
			SDL will detect this and put two events in the queue
			*/
			OnEvent(&Event);     
		}        
		OnLoop();   
		OnRender();   
	}

	OnCleanup();

	return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
	SDLGmud theSDLGmud;

	return theSDLGmud.OnExecute();
}

